<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>{$pagetitle}</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  <link rel="stylesheet" href="/static/admin/layui/css/layui.css" media="all">
  <link rel="stylesheet" href="/static/admin/style/admin.css" media="all">
  <link rel="stylesheet" href="/static/admin/style/global.css" media="all">
  <!--select2 js start-->
  <link rel="stylesheet" href="/static/select2/select2.css" media="all">
  <!--select2 js end-->  
  <style>
	  .set-select2 .select2-container .select2-choice{ height: 36px; line-height: 36px;}
	  .set-select2 .select2-container .select2-choice .select2-arrow b{ background: url(/static/select2/select2.png) no-repeat 0 4px;}
	  .select2-results .select2-highlighted{ background: #009688;}
  </style>
</head>
<body>

	<div class="layui-fluid">
	<div class="layui-card">
		
	<div class="layui-form-header">
		<div class="header-left" style="width:70%">
			<div class="layui-inline set-select2">
			  <select name="catid" class="select2" lay-ignore style="min-width:220px;" onchange="goLink(this)">{$catOption|raw}</select>
			  <a class="layui-btn" href="{:url('index',['catid'=>$cat['catid']])}"><i class="layui-icon layui-icon-ok-circle"></i> 已审核({$DataCount.index})</a>
			  <a class="layui-btn {$state=='readyCheck'?'':'layui-btn-primary'}" href="{:url('index_cache',['catid'=>$cat['catid'],'state'=>'readyCheck'])}"><i class="layui-icon layui-icon-fonts-clear"></i> 待审核({$DataCount.readyCheck})</a>
			  <a class="layui-btn {$state=='notCheck'?'':'layui-btn-primary'}" href="{:url('index_cache',['catid'=>$cat['catid'],'state'=>'notCheck'])}"><i class="layui-icon layui-icon-close"></i> 已退回({$DataCount.notCheck})</a>
			  <a class="layui-btn {$state=='draft'?'':'layui-btn-primary'}" href="{:url('index_cache',['catid'=>$cat['catid'],'state'=>'draft'])}"><i class="layui-icon layui-icon-edit"></i> 草稿({$DataCount.draft})</a>
			  <a class="layui-btn {$state=='to_publish'?'':'layui-btn-primary'}" href="{:url('index_cache',['catid'=>$cat['catid'],'state'=>'to_publish'])}"><i class="layui-icon layui-icon-edit"></i> 定时发布({$DataCount.to_publish})</a>
			  <a class="layui-btn {$state=='recycle'?'':'layui-btn-primary'}" href="{:url('index_cache',['catid'=>$cat['catid'],'state'=>'recycle'])}"><i class="layui-icon layui-icon-delete"></i> 回收站({$DataCount.recycle})</a>
			</div>  
		</div>
		
		<div class="header-right" style="width:30%;">
			<div class="layui-inline">
				{if $Request.param.openSearch}
				<a href="{:url('',['catid'=>$cat['catid'],'openSearch'=>0])}" class="layui-btn layui-btn-primary layuiadmin-btn-list"><i class="layui-icon layui-icon-up"></i> 关闭搜索</a>	
				{else /}
				<a href="{:url('',['catid'=>$cat['catid'],'openSearch'=>1])}" class="layui-btn layui-btn-primary layuiadmin-btn-list"><i class="layui-icon layui-icon-down"></i> 展开搜索</a>				
				{/if}
			
			  <a class="layui-btn layui-btn-primary layuiadmin-btn-list iframe" href="{:url('InfoImport/index',['catid'=>$cat['catid'],'state'=>'checked'])}" data-width="100%" data-height="100%"><i class="layui-icon layui-icon-app"></i> 导入</a>
			  <a class="layui-btn layui-btn-primary layuiadmin-btn-list" onclick="export_info()"><i class="layui-icon layui-icon-export"></i> 导出</a>			  
			  <a class="layui-btn" href="{:url('add',['catid'=>$cat['catid']])}"><i class="layui-icon layui-icon-addition"></i> 增加信息</a>
			</div>  
		</div>
		<div class="clear"></div>
		{if $Request.param.openSearch}
		<form action="{:url()}" method="get">
		<input type="hidden" name="catid" value="{$cat.catid}" />
		<input type="hidden" name="openSearch" value="1" />
        <div  class="layui-form layui-form-item info-search">
          <div class="layui-inline search-field">
            <label class="layui-form-label">
              <select lay-ignore name="searchField">
				  {foreach $SearchFieldInc as $v}
					<option value="{$v.field}" {if $Request.param.searchField==$v.field}selected{/if}>{$v.name}</option>
				  {/foreach}

			  </select>
			</label>
            <label class="layui-form-label" style="width: 80px;">
              <select lay-ignore name="searchFilter">
					<option value="like" {if $Request.param.searchFilter=='like'}selected{/if}>包含</option>
					<option value="notlike" {if $Request.param.searchFilter=='notlike'}selected{/if}>不包含</option>
					<option value="all" {if $Request.param.searchFilter=='all'}selected{/if}>完全匹配</option>
					<option value="eq" {if $Request.param.searchFilter=='eq'}selected{/if}>等于</option>
					<option value="neq" {if $Request.param.searchFilter=='neq'}selected{/if}>不等于</option>
					<option value="gt" {if $Request.param.searchFilter=='gt'}selected{/if}>大于</option>
					<option value="egt" {if $Request.param.searchFilter=='egt'}selected{/if}>大于等于</option>
					<option value="lt" {if $Request.param.searchFilter=='lt'}selected{/if}>小于</option>
					<option value="elt" {if $Request.param.searchFilter=='elt'}selected{/if}>小于待于</option>
			  </select>
			</label>			
            <div class="layui-input-inline">
              <input type="text" name="keywords" value="{$Request.param.keywords}" placeholder="请输入" autocomplete="off" class="layui-input">
            </div>
          </div>		

          <div class="layui-inline" style="width:300px; margin-left: 20px;">
            <div class="layui-input-block">
              <input type="checkbox" name="is_top" value="1" {if $Request.param.is_top}checked{/if} title="置顶">
              <input type="checkbox" name="is_good" value="1" {if $Request.param.is_good}checked{/if} title="推荐">
              <input type="checkbox" name="thumb" value="1" {if $Request.param.thumb}checked{/if} title="缩略图">
            </div>
          </div>	
							  

          <div class="layui-inline" style="width:400px">
            <label class="layui-form-label">时间</label>
            <div class="layui-input-inline" style="margin-right: 0px;">
              <input type="text" name="start_time" value="{$Request.param.start_time}" autocomplete="off" class="layui-input" id="test-laydate-start" placeholder="开始日期">
            </div>

			<div class="layui-input-inline">
				<input type="text" name="end_time" value="{$Request.param.end_time}" autocomplete="off" class="layui-input" id="test-laydate-end" placeholder="结束日期">
			</div>						  
          </div>

          <div class="layui-inline" style="float: right; width: auto; margin-right: 0px;">
            <button class="layui-btn layuiadmin-btn-list" lay-submit lay-filter="LAY-app-contlist-search">
              <i class="layui-icon layui-icon-search layuiadmin-button-btn"></i> 开始搜索
            </button>
            <a href="{:url('',['catid'=>$cat['catid'],'openSearch'=>0])}" class="layui-btn layui-btn-primary layuiadmin-btn-list" lay-submit lay-filter="LAY-app-contlist-search">
              <i class="layui-icon layui-icon-close layuiadmin-button-btn"></i> 关闭搜索功能
            </a>			
          </div>
        </div>	
	</form>
			
	{/if}
	</div>		

	<div class="layui-card-body">
	<form class="layui-form" action="{:url('updateSort')}" method="post" onsubmit="return save_form(this)" lay-filter="component-form-element">
		<input type="hidden" name="catid" value="{$cat.catid}">
	<table class="layui-table">
	  <colgroup>
		<col width="150">
		<col width="150">
		<col width="200">
		<col>
	  </colgroup>
	  <thead>
		<tr>
			<th width="3%"><input type="checkbox" value="0" class="checkall" lay-ignore></input></th>
			<th width="5%">排序</th>
			<th style="width:3%">id</th>
			<th style="width:10%">分类</th>
			<th style="width:40%;text-align: left;">标题</th>
			<th style="width:10%">用户</th>
			<th style="width:10%">时间</th>                 
			<th style="width:20%">操作</th>
		</tr> 
	  </thead>
	  <tbody>
	  {foreach $data as $key=>$v}
		<tr>
			<td style="text-align: center;"><input type='checkbox' class="chekboxs" name="ids[]" lay-ignore value="{$v.id}"></td>
			<td style="text-align: center;"><input type='text' value="{$v.sort}" name="sort[]" autocomplete="off" style="width:50px;text-align: center;"><input type='hidden' value="{$v.id}" name="id[]"></td>
			<td style="text-align: center;">{$v.id}</td>
			<td style="text-align: center;">{$v.cat.name}</td>
			<td class="tab-title">
				{if $v.has_temp }
				<a href="{:titleurl($v)}" target="_blank">{$v.title}</a>
				{else/}
				<a href="{:url('view',array('id'=>$v['id'],'catid'=>$v['catid']))}" class="iframe" title="预览"  data-width="80%" data-height="90%">{$v.title}</a>

				{/if}
				{if $v["is_top"]}
					<span class="layui-badge">顶</span>
				{/if}
				{if $v["is_good"]}
					<span class="layui-badge layui-bg-orange">推</span>
				{/if}	
				{if $v["thumb"]}
					<span class="layui-badge layui-bg-blue">图</span>
				{/if}	                                
			</td>
			<td class="center">{$v.username}</td>
			<td class="center">{:date("Y-m-d H:i",$v['newstime'])}</td>       
		  <td class="center">
			<a href="{:url('view',array('id'=>$v['id'],'catid'=>$v['catid']))}" class="layui-btn layui-btn-sm iframe" title="预览"  data-width="80%" data-height="90%"><i class="layui-icon">&#xe615;</i></a>
			<a href="{:url('update',array('catid'=>$v['catid'],'id'=>$v['id']))}" class="layui-btn layui-btn-sm" title="修改页面"><i class="layui-icon">&#xe642;</i></a>
			<a href="{:url('delete',array('catid'=>$v['catid'],'ids'=>$v['id']))}" class="layui-btn layui-btn-sm ajax_del"><i class="layui-icon">&#xe640;</i></a>
		  </td>
		</tr>
	   {/foreach}
	  </tbody>
	</table>
	
	<div class="layui-inline">
		<button class="layui-btn layui-btn-sm" onclick="$('.layui-form').attr('action','{:url("updateSort")}');$('.layui-form').submit();" type="button">排序</button>
		<button type="button" class="layui-btn layui-btn-danger layui-btn-sm" onclick="this_delete()">删除</button>
		
		<button type="button" class="layui-btn layui-btn-danger layui-btn-sm" onclick="cancel_checked()" type="button">取消审核</button>
		
		<ul class="layui-nav nav-button" style="margin-left: 10px;">
		  <li class="layui-nav-item layui-this">
			<a href="javascript:;">置顶</a>
			<dl class="layui-nav-child">
			  <dd><a onclick="$('.layui-form').attr('action','{:url("set_top",["value"=>1])}');$('.layui-form').submit();">置顶</a></dd>
			  <dd><a onclick="$('.layui-form').attr('action','{:url("set_top",["value"=>0])}');$('.layui-form').submit();">取消</a></dd>
			</dl>
		  </li>
		</ul>	
		<ul class="layui-nav nav-button" >
		  <li class="layui-nav-item layui-this">
			<a href="javascript:;">推荐</a>
			<dl class="layui-nav-child">
			  <dd><a onclick="$('.layui-form').attr('action','{:url("set_good",["value"=>1])}');$('.layui-form').submit();">推荐</a></dd>
			  <dd><a onclick="$('.layui-form').attr('action','{:url("set_good",["value"=>0])}');$('.layui-form').submit();">取消</a></dd>
			</dl>
		  </li>
		</ul>	

		<button class="layui-btn layui-btn-sm" type="button" onclick="copy_info()">复制</button>
		<button class="layui-btn layui-btn-sm" type="button" onclick="move_info()">移动</button>
						
	</div> 
	<div class="listpage">{$pagelist|raw}</div>
	</form>				  
	</div>
      
	</div>
</div>

  <script src="/static/admin/layui/layui.js"></script>
  <script src="/static/js/jquery.min.js"></script>    
  <script src="/static/js/globals.js"></script>  
  
  <!--select2 js start-->
  <script src="/static/select2/select2.js"></script>
  <!--select2 js end-->
  
  <script>
  $('.select2').select2();
  layui.config({
    base: '/static/admin/' //静态资源所在路径
  }).extend({
    index: 'lib/index' //主入口模块
  }).use(['index', 'form', 'laydate'], function(){
    var $ = layui.$
    ,admin = layui.admin
    ,element = layui.element
	,laydate = layui.laydate;
    //示例代码
    
    //开始日期
    var insStart = laydate.render({
      elem: '#test-laydate-start'
      ,done: function(value, date){
        //更新结束日期的最小日期
        insEnd.config.min = lay.extend({}, date, {
          month: date.month - 1
        });
        //自动弹出结束日期的选择器
       insEnd.config.elem[0].focus();
      }
    });
    
    //结束日期
    var insEnd = laydate.render({
      elem: '#test-laydate-end'
      ,min: 0
    });

  });
  //删除
	function this_delete(){
		layer.confirm("您确定要删除吗？",function(){
			$('.layui-form').attr('action','{:url("delete")}');
			$('.layui-form').submit();
		},function(){layer.closeAll();return false;});
	}
	//取消审核
	function cancel_checked(){
		layer.confirm("您确定要取消审核吗？",function(){
			$('.layui-form').attr('action','{:url("cancelChecked")}');
			$('.layui-form').submit();
		},function(){layer.closeAll();return false;});		
	}
	//栏目跳转
	function goLink(obj){
		var catid=$(obj).val();
		var url="{:url('Info/index')}?catid="+catid+"&keywords=";
		window.location.href=url;
	}	
	//复制信息
	function copy_info(){
		var chk_value =[];//定义一个数组    
		$('input[name="ids[]"]:checked').each(function(){
			chk_value.push($(this).val());
		});
		iframe("{:url('copy',['catid'=>$cat['catid']])}&ids="+chk_value);
	}
	//移动信息
	function move_info(){
		var chk_value =[];//定义一个数组    
		$('input[name="ids[]"]:checked').each(function(){
			chk_value.push($(this).val());
		});
		iframe("{:url('move',['catid'=>$cat['catid']])}&ids="+chk_value);
	}
	//导出
	function export_info(){
		var chk_value =[];//定义一个数组    
		$('input[name="ids[]"]:checked').each(function(){
			chk_value.push($(this).val());
		});
		iframe("{:url('export',['catid'=>$cat['catid']])}&ids="+chk_value,"800px");
	}
  </script>

</body>
</html>
